package com.zg.monitor.file.util;

import com.zg.monitor.file.vo.WatchVo;

import java.nio.file.WatchService;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Zxb
 */
public class WatchMap {
    public static Map<String, WatchVo> voMap = new HashMap<>();
    public static Map<String, WatchService> serviceMap = new HashMap<>();

    public static Boolean contains(String key) {
        return voMap.containsKey(key) && serviceMap.containsKey(key);
    }

    public static void put(String key, WatchVo watchVo, WatchService watchService) {
        voMap.put(key, watchVo);
        serviceMap.put(key, watchService);
    }

    public static WatchVo getVo(String key) {
        return voMap.get(key);
    }

    public static WatchService getService(String key) {
        return serviceMap.get(key);
    }

    public static void remove(String key) {
        voMap.remove(key);
        serviceMap.remove(key);
    }
}
